function changeText(url){
	var urlOut = document.getElementById("urlOut");
	var qrCodeImg = document.getElementById("qrCodeImg");
	if(urlOut){
		urlOut.value = url;
		qrCodeImg.src = "http://qr.liantu.com/api.php?w=300&text="+encodeURIComponent(url)+"&time="+new Date().getTime()
	}	
}

document.addEventListener('DOMContentLoaded', function () {
	var data = chrome.extension.getBackgroundPage().urldata;
	if(data.error===0){
		changeText(data.url);
	}else{
		changeText("获取数据失败");
	}
});
